home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Compilers⁄Interps / GCC-2.3.3r12 / Tests / pascal.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-01  |  2.1 KB  |  100 lines  |  [TEXT/MPS ]

  1. #include "testlib.h"
  2.  
  3. pascal char declthenuse_return_1st_plus1(char ch, short sh, long lo);
  4. pascal short declthenuse_return_2nd_plus1(char ch, short sh, long lo);
  5. pascal long declthenuse_return_3rd_plus1(char ch, short sh, long lo);
  6.  
  7. pascal char xxxthenuse_return_1st_plus1(char ch, short sh, long lo);
  8.  
  9. pascal char xxxthenuse_return_1st_plus1(char ch, short sh, long lo)
  10. {
  11.     return ch + 1;
  12. }
  13.  
  14. pascal char defthenuse_return_1st_plus1(char ch, short sh, long lo)
  15. {
  16.     return ch + 1;
  17. }
  18.  
  19. pascal short defthenuse_return_2nd_plus1(char ch, short sh, long lo)
  20. {
  21.     return sh + 1;
  22. }
  23.  
  24. pascal long defthenuse_return_3rd_plus1(char ch, short sh, long lo)
  25. {
  26.     return lo + 1;
  27. }
  28.  
  29. pascal int glob = 999;
  30.  
  31. typedef pascal int PasVarType;
  32.  
  33. PasVarType glob2 = 444;
  34.  
  35. test_pascal()
  36. {
  37.     Debugger();
  38. //    itesteq(__LINE__, 'b', defthenuse_return_1st_plus1('a', 12345, 123456789));
  39. //    itesteq(__LINE__, 12346, defthenuse_return_2nd_plus1('a', 12345, 123456789));
  40. //    itesteq(__LINE__, 987654322, defthenuse_return_3rd_plus1('a', 12345, 987654321));
  41.     itesteq(__LINE__, 'b', declthenuse_return_1st_plus1('a', 12345, 123456789));
  42.     itesteq(__LINE__, 12346, declthenuse_return_2nd_plus1('a', 12345, 123456789));
  43.     itesteq(__LINE__, 987654322, declthenuse_return_3rd_plus1('a', 12345, 987654321));
  44.     itesteq(__LINE__, 999, glob);
  45.     itesteq(__LINE__, 444, glob2);
  46. }
  47.  
  48. pascal char declthenuse_return_1st_plus1(char ch, short sh, long lo)
  49. {
  50.     return ch + 1;
  51. }
  52.  
  53. pascal short declthenuse_return_2nd_plus1(char ch, short sh, long lo)
  54. {
  55.     return sh + 1;
  56. }
  57.  
  58. pascal long declthenuse_return_3rd_plus1(char ch, short sh, long lo)
  59. {
  60.     return lo + 1;
  61. }
  62.  
  63. pascal short bar(char, short, long);
  64. pascal short (*tobar)(char, short, long);
  65.  
  66. typedef pascal short (*barptr)(char, short, long);
  67.  
  68. barptr tobar2;
  69. pascal barptr tobar3;
  70.  
  71. short fancy(barptr callback, short ditem);
  72.  
  73. test_pascal_2()
  74. {
  75.     foo(1, 2, 3);
  76.     bar(4, 5, 6);
  77.     (*tobar)(7, 8, 9);
  78.     (*tobar2)(10, 11, 12);
  79.     (*tobar3)(13, 14, 15);
  80.     fancy(tobar2, 12345);
  81. }
  82.  
  83. short fancy(barptr callback, short ditem)
  84. {
  85.     return (*callback)(1, ditem, 3);
  86. }
  87.  
  88.  
  89. int
  90. main()
  91. {
  92.     curtestfile = __FILE__;
  93.  
  94.     test_pascal();
  95.  
  96.     summary();
  97.  
  98.     return 0;
  99. }
  100.